﻿using System;
using System.ComponentModel.Composition;
using JXPlatform.GIS.Views;
using JXPlatform.Infrastructure;
using Microsoft.Practices.Prism.Logging;
using Microsoft.Practices.Prism.MefExtensions.Modularity;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;

namespace JXPlatform.GIS
{
    [ModuleExport(typeof(ModuleGis))]
    public class ModuleGis : IModule
    {
        private readonly ILoggerFacade _logger;

        [ImportingConstructor]
        public ModuleGis(ILoggerFacade logger, IRegionManager regionManager)
        {
            if (regionManager == null)
            {
                throw new ArgumentNullException("regionManager");
            }

            _logger = logger;
        }

        public void Initialize()
        {
            if (_logger != null)
            {
                _logger.Log("ModuleGIS demonstrates logging during Initialize().", Category.Info, Priority.Medium);
            }
        }
    }
}
